package com.cares.common.dao.orm;

import java.io.Serializable;
import java.util.Collection;

import cn.sh.cares.dao.DaoException;
import cn.sh.cares.dao.entity.BaseEntity;

/**
 * orm operation interface
  * Copyright: Copyright (c) 2011  
  * Company: 上海民航华东凯亚系统集成有限公司  
  * @author: 
  * @version: 
  * @date：Nov 29, 2011 2:45:25 PM
 */
public interface OrmExecution{
    
    <T> T get(Class<T> entityClass, Serializable id) throws DaoException;
    
    <T> T get(Class<T> entityClass, Serializable id, String[] initFields) throws DaoException;
    
    void update(BaseEntity entity) throws DaoException;
    
    void update(BaseEntity[] entities) throws DaoException;
    
    void update(Collection<? extends BaseEntity> entites) throws DaoException;

    void saveOrUpdate(BaseEntity entity) throws DaoException;
    
    void saveOrUpdate(Collection<? extends BaseEntity> entites) throws DaoException;
    
    void saveOrUpdate(BaseEntity[] entites) throws DaoException;
    
    void delete(BaseEntity entity) throws DaoException;

    void delete(BaseEntity[] entites) throws DaoException;
    
    void delete(Collection<? extends BaseEntity> entites) throws DaoException;
    
    void delete(Class<? extends BaseEntity> clz, Serializable id) throws DaoException;
    
    Serializable save(BaseEntity entity) throws DaoException;
    
    Serializable[] save(BaseEntity[] entites) throws DaoException;
    
    Serializable[] save(Collection<? extends BaseEntity> entites) throws DaoException;

    BaseEntity merge(BaseEntity entity) throws DaoException;
    
    BaseEntity merge(String entityName, BaseEntity entity) throws DaoException;

    void flush() throws DaoException;
    
    void clear() throws DaoException;
}